from django.db import models

from apps.category.models import CategoryModel


class DetailModel(models.Model):
    name = models.CharField(max_length=20, verbose_name='菜品名字')
    image_url = models.CharField(max_length=200, verbose_name='图片地址')
    main_materials = models.CharField(max_length=50, verbose_name='主料')  # 数据格式 => 西红柿;鸡蛋
    second = models.CharField(max_length=500, verbose_name='辅料')
    digest = models.CharField(max_length=1000, verbose_name='摘要')
    introduce = models.CharField(max_length=500, verbose_name='介绍')
    category = models.ForeignKey(CategoryModel, related_name='detail', verbose_name='所属分类')

    class Meta:
        db_table = 'tb_detail'
        verbose_name = '菜品详情'
        verbose_name_plural = verbose_name

    def __str__(self):
        return self.name
